#ifndef SMART_VECTOR_H
#define	SMART_VECTOR_H

#include <iostream>

class smart_vector
{
public:
   smart_vector();
   smart_vector(long long digit);
   smart_vector(const smart_vector& vector);
   ~smart_vector();
   
   smart_vector& operator=(const smart_vector& vector);

   size_t size() const;
   
   void push_back(long long digit);
   void pop_back();
   void swap(smart_vector& vector);
   void clear();
   
   void resize(size_t size, long long digit);
   void insert(int position, int count, long long digit);
   
   size_t begin();
   
   long long& operator[](size_t i);
   long long operator[](size_t i) const;
private:
   void grow(bool force = false);
   void shrink();
   
   union
   {
      long long* digits_;
      long long digit_;
   } content_;
   size_t size_;
   size_t capacity_;
};

#endif

